package com.itheima.controller;


import com.itheima.domain.Student;
import com.itheima.service.StudentService;
import com.itheima.service.StudentServiceImpl;
import org.junit.Test;

import java.util.List;

public class StudentTest {

    private StudentService studentService = new StudentServiceImpl();

    @Test
    public void testFindAll(){
        List<Student> students = studentService.findAll();
        for (Student student : students) {
            System.out.println(student);
        }
    }
    @Test
    public void testFindByNameAndAge(){
        List<Student> student = studentService.findByNameAndAge("李四", 24);
        System.out.println(student);
    }
    @Test
    public void testAddStu(){
        Student stu = new Student(7, "lili", 22);
        Integer result = studentService.addStu(stu);
        System.out.println(result);
        System.out.println(stu.getId());
    }
    @Test
    public void testUpdateStu(){
        Student stu = new Student(7,"找刘",22);
        Integer result = studentService.updateStu(stu);
        System.out.println(result);
    }
    @Test
    public void testDeleteStu(){
        Integer result = studentService.deleteStu(7);
        System.out.println(result);
    }
}
